class MinStack {

    public Stack<Integer> aux;
    public Stack<Integer> main;
    public MinStack() {
        aux = new Stack<>();
        main = new Stack<>();
        aux.push(Integer.MAX_VALUE);

    }

    public void push(int val) {
        main.push(val);
        if (val < aux.peek()){
            aux.push(val);
        }else{
            aux.push(aux.peek());
        }
    }

    public void pop() {
        main.pop();
        aux.pop();
    }

    public int top() {
        return main.peek();
    }

    public int getMin() {
        return aux.peek();
    }
}
